##
# @file
# @author
# @date
# #

import tkinter as tk


def get_half_screen_size():
    # 获取主屏幕的宽度和高度
    root = tk.Tk()
    screen_width = root.winfo_screenwidth()
    screen_height = root.winfo_screenheight()
    root.destroy()  # 不再需要这个临时的Tk实例，所以销毁它

    # 计算宽度和高度的一半
    half_width = screen_width // 2
    half_height = screen_height // 2

    return half_width, half_height


# 创建窗口
rootWin = tk.Tk()
# 获取显示器分辨率长宽的一半
half_width, half_height = get_half_screen_size()
print("half_width:%d, half_height:%d" % (half_width, half_height))
rootWin.title("虚拟地图")
# 设置窗口大小
rootWin.geometry(f"{half_width}x{half_height}")
rootWin.resizable(width=False, height=False)





rootWin.mainloop()
